<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib uri="/struts-tags" prefix="s"%>

<html>
	<head>
	<title>OSN Platform</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
	<style type="text/css">
    	#map_canvas { height: 100% }
	</style>

 <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
      var map;
      function initialize() {
    	var myLatlng = new google.maps.LatLng(getParam('lat'),getParam('lon'));
        var myOptions = {
        	      zoom: 14,
        	      center: myLatlng,
        	      mapTypeId: google.maps.MapTypeId.ROADMAP
        	    }
        	    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        	    
        	    var marker = new google.maps.Marker({
        	        position: myLatlng, 
        	        map: map,
        	        title:"Hello World!"
        	    });   
        	  }
    </script>
    
    <script type="text/javascript">
	function getParam(name) {

		name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
		var regexS = "[\\?&]" + name + "=([^&#]*)";
		var regex = new RegExp(regexS);
		var results = regex.exec(window.location.href);
		if (results == null)
			return "";
		else
			return results[1];
	}
</script>

 
<script type="text/javascript">


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18322085-34']);
  _gaq.push(['_trackPageview']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


</script>
    
</head>

<body onload="initialize()">
	<div id="container">
		<div id="header">
			<a href="http://opencities.upf.edu"><img src="images/logo.png"></a>
			<s:if test="#request.error == 'yes'">
				<h1>New service created</h1>
			</s:if>
			<s:else>
				<h1>
					<s:property value="currentService.name" />
				</h1>
			</s:else>
		</div>

		<s:include value="menu.jsp" />
		<div id="content">
			<div id="asideleft">
				<h2>Service Info</h2>
				<s:set name="metaDataURL"
					value="%{'http://193.145.50.132:8080/OSN/rest/service/getService/'+currentService.id}" />

				<s:set name="openDataURL"
					value="%{'http://193.145.50.132:8080/OSN/rest/service/getLastEntry/'+currentService.id}" />

				<s:if test="#session.user.email == currentService.author">
					<p>
						<b>Service Id:</b>
						<s:property value="currentService.id" />
					</p>
				</s:if>
				<p>
					<b>Name:</b>
					<s:property value="currentService.name" />
				</p>
				<p>
					<b>Author:</b>
					<s:property value="currentService.author" />
				</p>
				<p>
					<b>Description:</b>
					<s:property value="currentService.description" />
				</p>
				<p>
					<b>Update Period:</b>
					<s:property value="currentService.updatePeriod" />
				</p>
				<p>
					<b>Group:</b>
					<s:property value="currentService.group" />
				</p>
				<p>
					<b>Tags:</b>
					<s:property value="tempTagList" />
				</p>
				<br>
				<b>Meta data</b>
				<p>
					<s:a href="%{metaDataURL}.xml">
						<img src="images/xml.png" height="60">
					</s:a>
					<s:a href="%{metaDataURL}.json">
						<img src="images/json.png" height="60">
					</s:a>
				</p>

				<b>Open Data</b>
				<p>
					<s:a href="%{openDataURL}.xml">
						<img src="images/xml.png" height="60">
					</s:a>
					<s:a href="%{openDataURL}.json">
						<img src="images/json.png" height="60">
					</s:a>
				</p>
			</div>
			
			<div id="asideright">
				<div id="map_canvas" style="width: 600px; height: 450px; margin-top: 20px"></div>
			</div>
			
			<div id="bottom"></div>
		</div>
		<s:include value="footer.jsp" />
	</div>
</body>

</html>
